package com.ssy.lingxi.after.sale.model.constant;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 * 售后换货申请内部状态枚举
 * @author 伍将
 * @date 2020/9/11
 * @version 2.0.0
 */
public enum ReplaceGoodsInnerStatusEnum {

    /**
     * 所有
     */
    ALL(0, "所有", "", ""),
    /**
     * 待提交换货申请单 - 1
     */
    TO_BE_SUBMIT(1, "待提交", "待提交", "待提交"),
    /**
     * 审核通过(提交) - 2
     */
    SUBMIT_VERIFY_PASSED(2, "审核通过(提交)", "已提交", "审核通过(提交)"),
    /**
     * 审核不通过(提交)  - 30
     */
    SUBMIT_VERIFY_UN_PASSED(30, "审核不通过(提交) ", "已提交", "审核不通过(提交)"),
    /**
     * 审核通过(一级) - 3
     */
    VERIFY_STEP1_PASSED(3, "审核通过(一级)", "已提交", "审核通过(一级) "),
    /**
     * 审核不通过(一级) - 31
     */
    VERIFY_STEP1_UN_PASSED(31, "审核不通过(一级)", "已提交", "审核不通过(一级)"),
    /**
     * 审核通过(二级) - 4
     */
    VERIFY_STEP2_PASSED(4, "审核通过(二级)", "已提交", "审核通过(二级)"),
    /**
     * 审核不通过(二级)  - 5
     */
    VERIFY_STEP2_UN_PASSED(5, "审核不通过(二级) ", "已提交", "审核不通过(二级) "),
    /**
     * 审核通过(确认) - 6
     */
    CONFIRM_ACCEPT_APPLY(6, "审核通过(确认)", "已提交", "审核通过(确认)"),
    /**
     * 审核不通过(确认) - 7
     */
    CONFIRM_UN_ACCEPT_APPLY(7, "审核不通过(确认)", "已提交", "审核不通过(确认)"),
    /**
     * 待新增退货发货单 - 8
     */
    TO_BE_ADD_RETURN_DELIVERY_GOODS(8, "待新增退货发货单", "待新增退货发货单", "-"),
    /**
     * 待审核退货发货单 - 9
     */
    TO_BE_VERIFY_RETURN_DELIVERY_GOODS(9, "待审核退货发货单", "待审核退货发货单", "-"),
    /**
     * 待新退货增物流单 - 10
     */
    CONSUMER_TO_BE_ADD_LOGISTICS(10, "待新退货增物流单", "待新退货增物流单", "-"),
    /**
     * 待确认退货物流单 - 11
     */
    CONSUMER_TO_BE_CONFIRM_LOGISTICS(11, "待确认退货物流单", "待确认退货物流单", "-"),
    /**
     * 待确认退货发货 - 12
     */
    TO_BE_CONFIRM_RETURN_DELIVERY_GOODS(12, "待确认退货发货", "待确认退货发货", "-"),
    /**
     * 待新增退货入库单 - 13
     */
    TO_BE_ADD_RETURN_GOODS_STORAGE(13, "待新增退货入库单", "-", "待新增退货入库单"),
    /**
     * 待审核退货入库单 - 14
     */
    TO_BE_VERIFY_RETURN_GOODS_STORAGE(14, "待审核退货入库单", "-", "待审核退货入库单"),
    /**
     * 待确认退货收货 - 15
     */
    TO_BE_CONFIRM_RETURN_RECEIVE_GOODS(15, "待确认退货发货", "-", "待确认退货收货"),
    /**
     * 待确认退货回单 - 16
     */
    TO_BE_CONFIRM_RETURN_GOODS_RECEIPT(16, "待确认退货回单", "待确认退货回单", "-"),
    /**
     * 待新增换货发货单 - 17
     */
    TO_BE_ADD_REPLACE_DELIVERY_GOODS(17, "待新增换货发货单", "-", "待新增换货发货单"),
    /**
     * 待审核换货发货单 - 18
     */
    TO_BE_VERIFY_REPLACE_DELIVERY_GOODS(18, "待审核换货发货单", "-", "待审核换货发货单"),
    /**
     * 待新增换货物流单 - 19
     */
    SUPPLIER_TO_BE_ADD_LOGISTICS(19, "待新增换货物流单", "-", "待新增换货物流单"),
    /**
     * 待确认换货物流单 - 20
     */
    SUPPLIER_TO_BE_CONFIRM_LOGISTICS(20, "待确认换货物流单", "-", "待确认换货物流单"),
    /**
     * 待确认换货发货 - 21
     */
    TO_BE_CONFIRM_REPLACE_DELIVERY_GOODS(21, "待确认换货发货", "-", "待确认换货发货"),
    /**
     * 待新增换货入库单 - 22
     */
    TO_BE_ADD_REPLACE_GOODS_STORAGE(22, "待新增换货入库单", "待新增换货入库单", "-"),
    /**
     * 待审核换货入库单 - 23
     */
    TO_BE_VERIFY_REPLACE_GOODS_STORAGE(23, "待审核换货入库单", "待审核换货入库单", "-"),
    /**
     * 待确认换货收货 - 24
     */
    TO_BE_CONFIRM_REPLACE_RECEIVE_GOODS(24, "待确认换货收货", "待确认换货收货", "-"),
    /**
     * 待确认换货回单 - 25
     */
    TO_BE_CONFIRM_REPLACE_GOODS_RECEIPT(25, "待确认换货回单", "-", "待确认换货回单"),
    /**
     * 待确认售后完成 - 26
     */
    TO_BE_CONFIRM_COMPLETE(26, "待确认售后完成", "待确认售后完成", "待确认售后完成"),
    /**
     * 已确认售后完成 - 27
     */
    CONFIRM_COMPLETE(27, "已确认售后完成", "已确认售后完成", "已确认售后完成"),
    /**
     * 不接受退货物流单 - 28
     */
    CONSUMER_UN_ACCEPT_LOGISTICS(28, "不接受退货物流单", "不接受退货物流单", "-"),
    /**
     * 不接受换货物流单 - 29
     */
    SUPPLIER_UN_ACCEPT_LOGISTICS(29, "不接受换货物流单", "-", "不接受换货物流单"),
    /**
     * 已中止 - 30
     */
    STOPPED(32, "已中止","已中止","已中止");

    private final Integer code;
    private final String message;
    /**
     * 消费者描述
     */
    private final String consumerDescribe;
    /**
     * 供应者描述
     */
    private final String supplierDescribe;


    ReplaceGoodsInnerStatusEnum(Integer code, String message, String consumerDescribe, String supplierDescribe) {
        this.code = code;
        this.message = message;
        this.consumerDescribe = consumerDescribe;
        this.supplierDescribe = supplierDescribe;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return LanguageHolder.getName(this.getDeclaringClass(), this.getCode());
    }

    public String getConsumerDescribe() {
        return LanguageHolder.getName(this.getDeclaringClass().getSimpleName().concat(".consumerDescribe.").concat(this.getCode().toString()));
    }

    public String getSupplierDescribe() {
        return LanguageHolder.getName(this.getDeclaringClass().getSimpleName().concat(".supplierDescribe.").concat(this.getCode().toString()));
    }

    public static String getMessage(Integer code) {
        return Arrays.stream(ReplaceGoodsInnerStatusEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(ALL).getMessage();
    }

    public static ReplaceGoodsInnerStatusEnum getEnum(Integer code) {
        return Arrays.stream(ReplaceGoodsInnerStatusEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(ALL);
    }

    /**
     * 根据code查询描述
     * @param code code值
     * @param isSupplier 是否为消费者
     * @return 描述
     */
    public static String getDescribe(Integer code, Boolean isSupplier) {
        ReplaceGoodsInnerStatusEnum statusEnum = Arrays.stream(ReplaceGoodsInnerStatusEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(ALL);
        return (isSupplier ? statusEnum.getSupplierDescribe() : statusEnum.getConsumerDescribe());
    }
}
